package com.boot.mgt.controller.web

import com.boot.core.result.ResultEnum
import com.boot.core.result.ResultTo
import com.boot.mgt.service.TaAccidentService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * @author kawins
 * createTime 2019-03-07 14:16
 */
@RestController
@RequestMapping("/admin/statistics")
class TaStatisticsController {

    @Autowired
    private lateinit var accidentService: TaAccidentService

    /**
     * 接警等统计
     */
    @GetMapping("/accidentCount")
    fun accidentCount(time_begin: String, time_end: String): ResultTo {
        return if (!time_begin.isBlank() && !time_end.isBlank()) {
            accidentService.accidentCount(time_begin, time_end)
        } else {
            ResultTo(ResultEnum.PARAM_ERROR)
        }
    }

}